package com.frank.biz.jlzfdcwt.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.frank.common.annotation.Log;
import com.frank.common.enums.BusinessType;
import com.frank.biz.jlzfdcwt.domain.BizJlzfdcwt;
import com.frank.biz.jlzfdcwt.service.IBizJlzfdcwtService;
import com.frank.common.core.controller.BaseController;
import com.frank.common.core.domain.AjaxResult;
import com.frank.common.utils.poi.ExcelUtil;
import com.frank.common.core.page.TableDataInfo;

/**
 * 纪律作风督查Controller
 * 
 * @author frank
 * @date 2024-09-10
 */
@Controller
@RequestMapping("/biz/jlzfdcwt")
public class BizJlzfdcwtController extends BaseController
{
    private String prefix = "biz/jlzfdcwt";

    @Autowired
    private IBizJlzfdcwtService bizJlzfdcwtService;

    @RequiresPermissions("biz:jlzfdcwt:view")
    @GetMapping()
    public String jlzfdcwt()
    {
        return prefix + "/jlzfdcwt";
    }

    /**
     * 查询纪律作风督查列表
     */
    @RequiresPermissions("biz:jlzfdcwt:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(BizJlzfdcwt bizJlzfdcwt)
    {
        startPage();
        bizJlzfdcwt.setCreateBy(getLoginName());
        List<BizJlzfdcwt> list = bizJlzfdcwtService.selectBizJlzfdcwtList(bizJlzfdcwt);
        return getDataTable(list);
    }

    /**
     * 导出纪律作风督查列表
     */
    @RequiresPermissions("biz:jlzfdcwt:export")
    @Log(title = "纪律作风督查", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(BizJlzfdcwt bizJlzfdcwt)
    {
        bizJlzfdcwt.setCreateBy(getLoginName());
        List<BizJlzfdcwt> list = bizJlzfdcwtService.selectBizJlzfdcwtList(bizJlzfdcwt);
        ExcelUtil<BizJlzfdcwt> util = new ExcelUtil<BizJlzfdcwt>(BizJlzfdcwt.class);
        return util.exportExcel(list, "纪律作风督查数据");
    }

    /**
     * 新增纪律作风督查
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存纪律作风督查
     */
    @RequiresPermissions("biz:jlzfdcwt:add")
    @Log(title = "纪律作风督查", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(BizJlzfdcwt bizJlzfdcwt)
    {
        bizJlzfdcwt.setCreateBy(getLoginName());
        return toAjax(bizJlzfdcwtService.insertBizJlzfdcwt(bizJlzfdcwt));
    }

    /**
     * 修改纪律作风督查
     */
    @RequiresPermissions("biz:jlzfdcwt:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        BizJlzfdcwt bizJlzfdcwt = bizJlzfdcwtService.selectBizJlzfdcwtById(id);
        mmap.put("bizJlzfdcwt", bizJlzfdcwt);
        return prefix + "/edit";
    }

    /**
     * 修改保存纪律作风督查
     */
    @RequiresPermissions("biz:jlzfdcwt:edit")
    @Log(title = "纪律作风督查", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(BizJlzfdcwt bizJlzfdcwt)
    {
        bizJlzfdcwt.setUpdateBy(getLoginName());
        return toAjax(bizJlzfdcwtService.updateBizJlzfdcwt(bizJlzfdcwt));
    }

    /**
     * 删除纪律作风督查
     */
    @RequiresPermissions("biz:jlzfdcwt:remove")
    @Log(title = "纪律作风督查", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(bizJlzfdcwtService.deleteBizJlzfdcwtByIds(ids));
    }
}
